
<form method="post" action="add_book.php">
    Book title: <input type="text" name="book_name" /><br><br>
        <div>Authors: <select name="authors[]" multiple style="width: 200px">
            <?php
            foreach ($data['authors'] as $id=>$author_name) {
                echo '<option value="' .$id. '">
                    '.$author_name.'</option>';
            }
            ?>

        </select></div>
    <input type="submit" value="Add book" />    

</form>
<?php
     if (!empty($data['er'])) {
        foreach ($data['er'] as $errors) {
         echo $errors;
        }
     }
?>        